package com.baoleme.service;


import com.baoleme.controller.AddressBookController;
import com.baoleme.entity.AddressBook;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
@Slf4j
public class AddressByUserId {

    @Resource
    AddressBookService service;

    @Test
    public void addAddress(){
        AddressBook a1=new AddressBook();
        a1.setUserId("1837064306991091714");
        a1.setConsignee("李四四");
        a1.setPhone("16812345678");
        a1.setGender((byte) 1);
        a1.setProvinceName("福建省");
        a1.setCityName("厦门市");
        a1.setDistrictName("集美区");
        a1.setDetail("国贸高新实训基地2");
        a1.setIsDefault(0);
        service.save(a1);

    }


    @Test
    public void queryAddressById(){
        AddressBook a = service.getById(1838115759478280194L);
        System.out.println(a);

    }


    @Test
    public void deleteAddressById(){
        service.removeById("1838130288434089985");

    }


    @Test
    public void updateAddressById(){
        AddressBook a1=new AddressBook();
        a1.setId("1838130562859024385");
        a1.setProvinceName("福建省");
        a1.setCityName("福州市");
        a1.setDistrictName("台江区");
        a1.setDetail("国贸高新实训基地3");
        a1.setIsDefault(0);

        service.updateById(a1);

    }


    @Test
    public void UserAddressById(){


        service.queryAllAddressByUserId("1837051018777481218");

    }


}
